= kujaku do |k|
  - k.text
  - k.helper :journal_period_crit
  - p_ids = FixedAsset.all.pluck(:product_id).compact.uniq
  - products = Product.where(id: p_ids).reorder(:name)
  - if products.any?
    - k.helper do
      %label= Product.human_attribute_name(:name)
      = select_tag(:product_id, options_for_select([[]] +  products.map{|u| [u.name, u.id]}, params[:product_id].to_i))
- main_toolbar do |t|
  = t.new params: { redirect: nil }
  = t.export :fixed_asset_registry, key: Time.zone.now.to_s, resource: @fixed_assets

  %span.btn-group.action-form
    - depreciate_until = params[:until].to_s =~ /\A\d\d\d\d\-\d\d\-\d\d\z/ ? params[:until].to_date : (Time.zone.today - 1.month).end_of_month
    = link_to :account_for.tl, { action: :depreciate_all, until: depreciate_until.iso8601, redirect: request.fullpath }, { class: 'btn btn-default', data: { confirm: :are_you_sure.tl, update_link_with: '#depreciate-fixed-assets-until' }, method: :post }
    %span.add-on= :up_to.tl.downcase
    = date_field_tag(:until, depreciate_until, id: 'depreciate-fixed-assets-until', data: { max_date: Time.zone.today.iso8601 })

= main_list
